package com.woniu40.petai_user.mapper;

import com.woniu40.petai_user.entity.Cart;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface CartMapper {

    int insertCart(Cart cart);

    int updateCart(Cart cartToUpdate);

    Cart selectCartById(Integer cartId);

    List<Cart> selectCartByIds(@Param("cartIds") List<Integer> cartIds);

    List<Cart> selectCartByUserId(Integer userId);

    int deleteCart(Integer cartId);

    int deleteBatch(@Param("cartIds") List<Integer> cartIds);

    int deleteByOrderBatch(Integer orderId);

    int deleteCartAll();


    //==========================自己写=========================================

    Cart select(Integer cartId);

    int updateBuyCount(@Param("cartId") Integer cartId, @Param("buyCount") Integer buyCount);

    int deleteOrder(@Param("cartId") Integer cartId, @Param("userId") Integer userId);

    int deleteAllOrder(@Param("userId") Integer userId);

}
